package com.pwernode.controller;

import jakarta.annotation.Resource;
import org.springframework.ai.openai.OpenAiAudioTranscriptionModel;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.nio.file.spi.FileSystemProvider;

@RestController
public class TranscriptionController {

    @Resource
    private OpenAiAudioTranscriptionModel openAiAudioTranscriptionModel;

    @RequestMapping("/ai/transcription")
    public Object transcription(){

       org.springframework.core.io.Resource  resource =  new ClassPathResource("4258538812.mp3");
        String call = openAiAudioTranscriptionModel.call(resource);
        return  call;

    }
}
